CentOS 6
Sponsored Link

Redundant Configuration for NIC (bonding)
2013/07/23
 
Set Redundant Configuration for NIC (bonding).
This example based on the environment that the computer has 2 NIC and Interface name is eth0 and eth1. Please replace those values for your environment.
[1] Configure bonding
[root@dlp ~]#
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# change like follows

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
MASTER=bond0
SLAVE=yes

[root@dlp ~]#
vi /etc/sysconfig/network-scripts/ifcfg-eth1
# change like follows

DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
MASTER=bond0
SLAVE=yes

[root@dlp ~]#
vi /etc/sysconfig/network-scripts/ifcfg-bond0
# Create new like follows (replace the IPADDR/GATEWAY/DNS1 to your values)

DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
IPADDR=10.0.0.100
GATEWAY=10.0.0.1
DNS1=10.0.0.10
BONDING_OPTS="mode=1 primary=eth0 miimon=500"

[root@dlp ~]#
/etc/rc.d/init.d/network restart

Shutting down interface bond0:                             [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:                               [  OK  ]

[root@dlp ~]#
bond0     Link encap:Ethernet  HWaddr 00:24:1D:13:7A:26
          inet addr:10.0.0.100  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::224:1dff:fe13:7a26/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:4588926 errors:0 dropped:1425 overruns:0 frame:0
          TX packets:2067375 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6939378147 (6.4 GiB)  TX bytes:141018635 (134.4 MiB)

eth0      Link encap:Ethernet  HWaddr 00:24:1D:13:7A:26
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:322066 errors:0 dropped:0 overruns:0 frame:0
          TX packets:285472 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:485688628 (463.1 MiB)  TX bytes:20867225 (19.9 MiB)

eth1      Link encap:Ethernet  HWaddr 00:1D:73:78:94:1E
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:4266861 errors:0 dropped:1425 overruns:0 frame:0
          TX packets:1781904 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6453689579 (6.0 GiB)  TX bytes:120151644 (114.5 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:720 (720.0 b)  TX bytes:720 (720.0 b)
[2]
The Configuration is completed. Please make sure it works normally to unplug a cable.
 
The example above shows to set the Mode "1" but there are some other Mode like follows.
Mode Mode Name
Description
0 balance-rr
Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.
1 active-backup
Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
2 balance-xor
Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
3 broadcast
Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
4 802.3ad
Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.
5 balance-tlb
Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.
6 balance-alb
Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP negotiation.
 
Tweet